package org.timemachine.context;

public class TMThreadLocal {

	public static final ThreadLocal<Context> userThreadLocal = new ThreadLocal<Context>();

	public static void setContext(Context context) {
		userThreadLocal.set(context);
	}

	public static void unset() {
		userThreadLocal.remove();
	}

	public static Context getContext() {
		if (userThreadLocal.get() == null) {
			userThreadLocal.set(new Context());
		}
		return userThreadLocal.get();
	}

}
